package org.secangkirkopipanas.gxtcore.domain.dto;

import java.util.Date;

import net.sf.hibernate4gwt.pojo.java5.LazyPojo;

import org.secangkirkopipanas.gxtcore.domain.ISystemUser;

public class SystemUserDTO extends LazyPojo implements ISystemUser {

	private static final long serialVersionUID = 1L;

	private String username;
	private String pwdDigest;
	private String firstname;
	private String lastname;
	private SystemGroupDTO group;
	private String title;
	private String workLocation;
	private String workPhoneNumber;
	private Date lastLoginDate;
	private String lastLoginAddress;
	private boolean locked = false;

	public SystemUserDTO() {
		super();
	}

	public SystemUserDTO(String userId) {
		super();
		this.username = userId;
	}

	public SystemUserDTO(String username, String pwdDigest, String firstname,
			String lastname, SystemGroupDTO group, String title,
			String workLocation, String workPhoneNumber, Date lastLoginDate,
			String lastLoginAddress, boolean locked) {
		super();
		this.username = username;
		this.pwdDigest = pwdDigest;
		this.firstname = firstname;
		this.lastname = lastname;
		this.group = group;
		this.title = title;
		this.workLocation = workLocation;
		this.workPhoneNumber = workPhoneNumber;
		this.lastLoginDate = lastLoginDate;
		this.lastLoginAddress = lastLoginAddress;
		this.locked = locked;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPwdDigest() {
		return pwdDigest;
	}

	public void setPwdDigest(String pwdDigest) {
		this.pwdDigest = pwdDigest;
	}

	public String getFirstname() {
		return firstname;
	}

	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	public String getLastname() {
		return lastname;
	}

	public void setLastname(String lastname) {
		this.lastname = lastname;
	}

	public SystemGroupDTO getGroup() {
		return group;
	}

	public void setGroup(SystemGroupDTO group) {
		this.group = group;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getWorkLocation() {
		return workLocation;
	}

	public void setWorkLocation(String workLocation) {
		this.workLocation = workLocation;
	}

	public String getWorkPhoneNumber() {
		return workPhoneNumber;
	}

	public void setWorkPhoneNumber(String workPhoneNumber) {
		this.workPhoneNumber = workPhoneNumber;
	}

	public Date getLastLoginDate() {
		return lastLoginDate;
	}

	public void setLastLoginDate(Date lastLoginDate) {
		this.lastLoginDate = lastLoginDate;
	}

	public String getLastLoginAddress() {
		return lastLoginAddress;
	}

	public void setLastLoginAddress(String lastLoginAddress) {
		this.lastLoginAddress = lastLoginAddress;
	}

	public boolean isLocked() {
		return locked;
	}

	public void setLocked(boolean locked) {
		this.locked = locked;
	}

	public boolean isSystemAdmin() {
		return (SystemGroupDTO.SYSADMIN_GROUP_ID == group.getId());
	}

}